package com.rslai.commons.http.data;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;
import java.util.List;

/**
 * http 参数实体
 * Created by lrs on 2018/8/6.
 */
public class HttpParameter {

    private List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

    /**
     * 返回所有参数
     * @return NameValuePair list
     */
    public List<NameValuePair> getNameValuePairs() {
        return nameValuePairs;
    }

    /**
     * 添加 key value 到 http 参数中
     * @param key key
     * @param value value
     * @return HttpParameter
     */
    public HttpParameter put(String key, String value) {
        nameValuePairs.add(new BasicNameValuePair(key, value));
        return this;
    }
}
